home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group03a.txt
/
000013_icon-group-sender_Wed Feb 12 08:13:31 2003.msg
< prev
next >
Wrap
Internet Message Format
|
2003-12-22
|
2KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id h1CFDUh14835
for icon-group-addresses; Wed, 12 Feb 2003 08:13:30 -0700 (MST)
Message-Id: <200302121513.h1CFDUh14835@baskerville.CS.Arizona.EDU>
X-Sender: whm@mail.mse.com (Unverified)
Date: Wed, 12 Feb 2003 01:15:06 -0700
To: ernobe <ernobe@yahoo.com>
From: "William H. Mitchell" <whm@mse.com>
Subject: Re: data values
Cc: icon-group@cs.arizona.edu
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
At 05:02 PM 2/11/03 -0600, ernobe wrote:
>>
>The whole section immediately following, entitled "Data Backtracking"
>might as well be paraphrased as "There is such a thing as data
>backtracking". Would it be right to conclude from it that the success
>of expressions in a logical conjunction does not depend on the success
>of the final expression, while the success of the conjunction as a whole
>does?
It sounds like you've got the right understanding about that.
An important thing to understand about the "&" is that it is simply a
trivial operator. If it weren't in the language, you could mimic it with
this procedure:
procedure and(e1, e2)
return e2
end
Instead of 'x < 10 & y < 20', you might write 'and(x < 10, y < 20)'. In
both cases, if x < 10 fails, y < 20 is never evaluated. The underlying
principle is that if an evaluation of an operand (or argument) fails, the
operator (or procedure) is never called. Likewise, in '(x < 10) + (y <
20)', if x < 10 fails, the second comparison and the addition are just
never done.
I point out to students that in a conventional language implementation of
logical conjunction and logical disjunction is pretty similar. In Icon,
implementation of the analagous elements, & and |, are at opposite ends of
the difficulty spectrum.